package org.example.springbook.controller;

import jakarta.servlet.http.HttpSession;
import lombok.extern.slf4j.Slf4j;
import org.example.springbook.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RequestMapping("/user")
@RestController
public class UserController {
    @Autowired
    private UserService userService;
    @RequestMapping("/login")
    public Boolean login(String name, String password, HttpSession session){
        System.out.println(("接收到的参数:" + name));
        Boolean result = userService.checkUserAndPassword(name,password,session);

        log.info("用户登录结果，name:{},password:{},结果：{}",name,password,result);
        return result;
    }
}
